
const { app, BrowserWindow, nativeTheme, ipcMain } = require('electron')
const path = require('path')
console.log('isDarkMode', nativeTheme.shouldUseDarkColors)

ipcMain.handle('setTheme',(event,theme)=>{
    nativeTheme.themeSource = theme
})

app.whenReady().then(()=>{
    createWindow()
})

function createWindow() {
    let mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences:{
            nodeIntegration:false,
            sandbox:false,
            preload:path.join(__dirname,'../preload.js')
        }
    })
    mainWindow.loadFile(path.join(__dirname, '../renderer/index.html'))
}